package com.htzos.admin.system.service;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.htzos.admin.system.bean.SystemUserBase;
import com.htzos.admin.system.dao.SystemUserBaseMapper;
import com.htzos.admin.system.dao.SystemUserroleBaseMapper;
import com.htzos.common.tool.ExtQueryBean;
@Service
@Transactional(rollbackFor = Exception.class)
public class SystemUserBaseService {
    @Autowired
    SystemUserBaseMapper systemUserBaseMapper;
    @Autowired
    SystemUserroleBaseMapper systemUserroleBaseMapper;
    
    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public List<SystemUserBase> systemUserBaseList(SystemUserBase systemUserBase, ExtQueryBean extQuery){
       return systemUserBaseMapper.systemUserBaseList(systemUserBase, extQuery);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public List<SystemUserBase> systemUserBaseViewList(SystemUserBase systemUserBase, ExtQueryBean extQuery){
       return systemUserBaseMapper.systemUserBaseViewList(systemUserBase, extQuery);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public Integer systemUserBaseTotal(SystemUserBase systemUserBase, ExtQueryBean extQuery){
       return systemUserBaseMapper.systemUserBaseTotal(systemUserBase, extQuery);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public Integer systemUserBaseViewTotal(SystemUserBase systemUserBase, ExtQueryBean extQuery){
       return systemUserBaseMapper.systemUserBaseViewTotal(systemUserBase, extQuery);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public int systemUserBaseUpdate(SystemUserBase systemUserBase){
       return systemUserBaseMapper.systemUserBaseUpdate(systemUserBase);
    }

    @Transactional(propagation = Propagation.REQUIRED)
    public int systemUserBaseInsert(SystemUserBase systemUserBase){
       return systemUserBaseMapper.systemUserBaseInsert(systemUserBase);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public int systemUserBaseDelete(SystemUserBase systemUserBase){
    	systemUserroleBaseMapper.systemUserroleBaseDeleteByUserId(systemUserBase.getId());
    	return systemUserBaseMapper.systemUserBaseDelete(systemUserBase);
    }

    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public SystemUserBase systemUserBaseGet(Integer id){
       return systemUserBaseMapper.systemUserBaseGet(id);
    }
}
